package com.lx.patterns.memento.black;

/**
 * @ClassName Client
 * @Description: 测试客户端
 * @Author: 落雪
 * @CreateDate: 2025/2/15 15:31
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/2/15 15:31
 * @UpdateRemark:
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {
        System.out.println("------------大战Boss前------------");
        //大战Boss前
        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.showState();

        //保存进度
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setMemento(gameRole.saveState());

        System.out.println("------------大战Boss后------------");
        //大战Boss时，损耗严重
        gameRole.fight();
        gameRole.showState();
        System.out.println("------------恢复之前状态------------");
        //恢复之前状态
        gameRole.recoverState(roleStateCaretaker.getMemento());
        gameRole.showState();

    }
}
